﻿
// **************************************************************************
//    Class Created by Mick Doherty (Dotnetrix) Feb 2010
//    http://dotnetrix.co.uk/
//
//    ...for GlassUI (an AeroGlass UI Library)
//    http://glassui.codeplex.com/
// **************************************************************************

using System;
using System.Runtime.InteropServices;

namespace GlassUI
{
    internal sealed partial class NativeMethods
    {
        internal sealed class GDI32
        {
            private GDI32() { }

            #region Method Imports

            [DllImport("gdi32.dll")]
            [return: MarshalAs(UnmanagedType.Bool)]
            public static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop);

            [DllImport("gdi32.dll")]
            public static extern IntPtr CreateCompatibleDC(IntPtr hdc);

            [DllImport("gdi32.dll")]
            public static extern IntPtr CreateDIBSection(IntPtr hdc, ref BITMAPINFO pbmi, uint iUsage, IntPtr ppvBits, IntPtr hSection, uint dwOffset);

            [DllImport("gdi32.dll", SetLastError = true)]
            [return: MarshalAs(UnmanagedType.Bool)]
            public static extern bool DeleteDC(IntPtr hdc);

            [DllImport("gdi32.dll", SetLastError = true)]
            [return: MarshalAs(UnmanagedType.Bool)]
            public static extern bool DeleteObject(IntPtr hObject);

            [DllImport("gdi32.dll")]
            public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hObject);

            [DllImport("gdi32.dll")]
            public static extern int SetBkMode(IntPtr hdc, int iBkMode);

            [DllImport("gdi32.dll")]
            public static extern IntPtr GetStockObject(int fnObject);

            [DllImport("gdi32.dll", SetLastError = true)]
            public static extern int SelectClipRgn(IntPtr hdc, IntPtr hrgn);

            #endregion

            #region Structures

            [StructLayout(LayoutKind.Sequential)]
            public struct BITMAPINFO
            {
                public BITMAPINFOHEADER biHdr;
                [MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst = 256)]
                public RGBQUAD[] bmiColors;
            }

            [StructLayout(LayoutKind.Sequential)]
            public struct BITMAPINFOHEADER
            {
                public int biSize;
                public int biWidth;
                public int biHeight;
                public short biPlanes;
                public short biBitCount;
                public BITMAPCOMPRESSION biCompression;
                public int biSizeImage;
                public int biXPelsPerMeter;
                public int biYPelsPerMeter;
                public int biClrUsed;
                public int biClrImportant;
            }

            [StructLayout(LayoutKind.Sequential)]
            public struct RGBQUAD
            {
                public byte rgbBlue;
                public byte rgbGreen;
                public byte rgbRed;
                public byte rgbAlpha;
            }

            #endregion

            #region Enumerations

            public enum BITMAPCOMPRESSION
            {
                RGB,
                RLE8,
                RLE4,
                BITFIELDS,
                JPEG,
                PNG
            }

            #endregion

            #region Constants

            public static int TRANSPARENT = 1;
            public static int HOLLOW_BRUSH = 5;

            #endregion
        }
    }
}
